﻿using System.Diagnostics;

namespace Scheduler
{
    [DebuggerStepThrough]
    public abstract class Middleware
    {
        protected int St;

        protected object[] UserData;
        [DebuggerStepThrough]
        protected Middleware(params object[] userData)
        {
            UserData = userData;
        }
        [DebuggerStepThrough]
        public abstract bool Filter(Context ctx, EventArgs args);
        [DebuggerStepThrough]
        public void HandleEvent(Context ctx, EventArgs args)
        {
            if (Filter(ctx, args))
            {
                DoHandleEvent(ctx, args);
            }
        }
        [DebuggerStepThrough]
        protected abstract void DoHandleEvent(Context ctx, EventArgs args);

    }
}